package com.eedi.framework.notify.dal.dataobject;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.eedi.framework.common.enums.UserTypeEnum;
import com.eedi.framework.common.enums.YesOrNoEnum;
import com.eedi.framework.mybatis.core.dataobject.BaseDO;
import com.eedi.framework.notify.enums.SysNotifyTemplateTypeEnum;
import lombok.*;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 站内信 DO
 *
 * @author xrcoder
 */
@TableName(value = "sys_notify_message", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SysNotifyMessageDO extends BaseDO {

    /**
     * 站内信编号，自增
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String sysNotifyMessageId;
    /**
     * 用户编号
     *
     * 关联 SysUserDO 的 id 字段、或者 AdminUserDO 的 id 字段
     */
    private String sysUserId;
    /**
     * 用户类型
     *
     * 枚举 {@link UserTypeEnum}
     */
    private UserTypeEnum sysUserType;

    // ========= 模板相关字段 =========

    /**
     * 模版编号
     *
     * 关联 {@link SysNotifyTemplateDO#getSysNotifyTemplateId()} ()} ()}
     */
    private String sysNotifyTemplateId;
    /**
     * 模版编码
     *
     * 关联 {@link SysNotifyTemplateDO#getSysNotifyCode()} ()} ()}
     */
    private String sysNoticeCode;
    /**
     * 模版类型
     *
     * 冗余 {@link SysNotifyTemplateDO#getSysNotifyType()} ()} ()}
     */
    private SysNotifyTemplateTypeEnum sysNoticeType;
    /**
     * 模版发送人名称
     *
     * 冗余 {@link SysNotifyTemplateDO#getSysNotifyNickname()} ()} ()}
     */
    private String sysNoticeNickname;
    /**
     * 模版内容
     *
     * 基于 {@link SysNotifyTemplateDO#getSysNotifyContent()} ()} ()} 格式化后的内容
     */
    private String sysNoticeContent;
    /**
     * 模版参数
     *
     * 基于 {@link SysNotifyTemplateDO#getSysNotifyParams()} ()} ()} 输入后的参数
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Object> sysNoticeParams;

    // ========= 读取相关字段 =========

    /**
     * 是否已读
     */
    private YesOrNoEnum sysNoticeReadStatus;
    /**
     * 阅读时间
     */
    private LocalDateTime sysNoticeReadTime;

}
